package day8;

import java.util.List;

/**
 * @author oldliu
 * @since 1.0
 */
public class ListError extends Thread {
    private  List<String> list;

    public ListError(String name, List<String> list){
        super(name);
        this.list=list;
    }

    @Override
    public  void run() {
        for(int i=1;i<=1000;i++){

            synchronized (list){
                list.add(this.getName()+":"+i);
            }
            System.out.println("list当前大小:"+list.size());
        }
    }
}
